<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="decorator" content="default" />
<title>材料领取数据管理</title>
<script type="text/javascript">
	$(document).ready(
			function() {
				$('#projectId').val('${assGet.project.id}').trigger('change');
				$("#sbxh").select2({tags:eval('${fns:getDictValueListJson('yqxh')}'),maximumSelectionSize: 1});
				$("#jpgg").select2({tags:eval('${fns:getDictValueListJson('jpgg')}'),maximumSelectionSize: 1});
				$("#jpxh").select2({tags:eval('${fns:getDictValueListJson('jpjdj')}'),maximumSelectionSize: 1});
				$("#inputForm")
						.validate(
								{
									submitHandler : function(form) {
										loading('正在提交，请稍等...');
										form.submit();
									},
									errorContainer : "#messageBox",
									errorPlacement : function(error, element) {
										$("#messageBox").text("输入有误，请先更正。");
										if (element.is(":checkbox")
												|| element.is(":radio")
												|| element.parent().is(
														".input-append")) {
											error.appendTo(element.parent()
													.parent());
										} else {
											error.insertAfter(element);
										}
									}
								});
			});
	
	function loadSubProject(projectId) {
		if(!projectId) {
			$('#subPro').html('<option value="">请选择单位工程</option>');
			$('#subPro').select2('val','');
			return;
		}
		$.post(
			'${ctx}/project/subProject/listSubByPro',	
			{projectId: projectId},
			function(data, textStatus, jqXHR) {
				var html = '<option value="">请选择单位工程</option>';
				for(var i=0;i<data.length;i++) {
					html+= '<option value="'+data[i].id+'">'+data[i].name+'</option>';
				}
				$('#subPro').html(html);
				$('#subPro').val('${assGet.subProject.id}').trigger('change');
			},'json');
		
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li ><a href="${ctx}/project/assGet/list">材料领取数据列表</a></li>
		<li class="active"><a href="${ctx}/project/assGet/form">材料领取数据添加</a></li>
	</ul>
	<common:message content="${message}" />
	<form:form id="inputForm" modelAttribute="assGet"
		action="${ctx}/project/assGet/save" method="post" class="form-horizontal">
		<form:hidden path="id" />
		<div class="row">
			<div class="span6">
				<div class="control-group">
				   <label class="control-label">工程:</label>
					<div class="controls">
					<select name="project.id" class="input-large required" onchange="loadSubProject(this.value)" id="projectId">
						<option value="">请选择工程</option>
						<c:forEach items="${projectList}" var="p">
							<option value="${p.id}">${p.name}</option>
						</c:forEach>
					</select>
					<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">单位工程:</label>
					<div class="controls">
					<select id="subPro" name="subProject.id" class="input-large required" >
						<option value="">请选择单位工程</option>
					</select>
					<span class="help-inline"><font color="red">*</font> </span>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">装置:</label>
					<div class="controls">
						<form:input path="zz" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">工号:</label>
					<div class="controls">
						<form:input path="gh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">仪器型号:</label>
					<div class="controls">
						<form:input path="sbxh" cssClass="input-large"/>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">胶片型号:</label>
					<div class="controls">
						<form:input path="jpxh" htmlEscape="false" maxlength="50"
							class="input-large" />
					</div>
				</div>
			</div>
		</div>
		
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">胶片规格:</label>
					<div class="controls">
						<form:input path="jpgg" htmlEscape="false" maxlength="50"
							class="input-large required" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">数量:</label>
					<div class="controls">
						<form:input path="sl" htmlEscape="false" maxlength="50"
							class=" digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">领取日期:</label>
					<div class="controls">
					<input name="lqrq" type="text"  maxlength="20" class="input-large Wdate" value="${assGet.lqrq}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">拍片损毁:</label>
					<div class="controls">
						<form:input path="ppsh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">洗片损毁:</label>
					<div class="controls">
						<form:input path="xpsh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">底片质量损毁:</label>
					<div class="controls">
						<form:input path="dpzlsh" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">交回日期:</label>
					<div class="controls">
					<input name="jhrq" type="text"  maxlength="20" class="input-large Wdate" value="${assGet.jhrq}"
			onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">交回数量:</label>
					<div class="controls">
						<form:input path="jhsl" htmlEscape="false" maxlength="50"
							class="digits" />
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">验收情况:</label>
					<div class="controls">
						<form:input path="ysqk" htmlEscape="false" maxlength="50"
							class="" />
					</div>
				</div>
			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">领取人员:</label>
					<div class="controls">
						<form:input path="lqry" htmlEscape="false" maxlength="50"
							/>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="span6">
				<div class="control-group">
					<label class="control-label">备注:</label>
					<div class="controls">
						<form:input path="remarks" htmlEscape="false" maxlength="50"
							/>
					</div>
				</div>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit"
				value="保 存" />&nbsp; 
				<input id="btnCancel" class="btn" type="button"
				value="返 回" onclick="history.go(-1)" />
		</div>
	</form:form>
</body>
</html>